DPMI
The DOS Protected Mode Interface (DPMI) allows DOS programs to access the extended memory of PC architecture computers while maintaining system protection.  DPMI defines a specific subset of DOS and BIOS calls that protected mode DOS programs can make. It also defines a new interface via software interrupt 31h that protected mode programs use to allocate memory, modify descriptors, call real mode software, interrupts, etc.  Any operating system that currently supports virtual DOS sessions should be capable of supporting DPMI without affecting system security.


VBIO VBX Helpfile

Properties	Events	Methods

Description

The VBIO VBX is a Visual Basic Custom Control that allows you to get and set miscellaneous file- and disk- attributes. Features include setting filedate and time, file-attributes, disk volume-label and serial number and determining a file's size, free diskspace, total diskspace, filesystem type and whether a drive is a CD-ROM drive or a network drive. The VBX is invisible at run-time. You communicate with the VBX by getting and setting the file and disk-properties.

File Name

VBIO.VBX

Object Type

VBIO

Toolbox Icon

Remarks

The VBIO VBX allows you to modify a lot of file- and disk-properties you normally cannot access. If an error occurs, VBIO can report errors in two ways depending on the setting of the ErrorMode property. The default (ErrorMode = 0) is not to generate a runtime error but instead report the error in it's Error (number) and ErrorMessage (string) properties. In this case, the only time VBIO generates a run-time error is when you try to set the value of a read-only property, such as FreeDiskSpace. Alternatively, the VBX can report all errors as run-time errors as well.

The VBX updates changes immediately. For example, to change a drive's volume-label, you simply specify a new value for the VolumeLabel property.

License Agreement and Disclaimer

This is a legal agreement between you (either an individual or an entity) and SheAr software. By using the VBIO VBX you are agreeing to be bound by the terms of this Agreement. If you do not agree to the terms of this Agreement, simply do not use the VBX.

FREEWARE. The VBIO VBX is free. That means that you may use it any application you write without charge. If you really like it, send us a postcard.

NO WARRANTIES.  SheAr software expressly disclaims any warranty for the VBIO VBX. The

VBX and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the VBIO VBX remains with you.

NO LIABILITY FOR CONSEQUENTIAL DAMAGES.  In no event shall SheAr software be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use or inability to use this product. This holds even if SheAr software has been advised of the possibility of such damages. Because some states or jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.

Distribution note	When you create and distribute applications that use the VBIO control, you should install the file VBIO.VBX in the customer's Microsoft Windows \SYSTEM subdirectory.


Properties

The following table lists all of the properties for this control. Properties that apply only to this control, or that require special considerations when used with it, are marked with an asterisk (*).

*Action	*Archive	*BytesPerSector	*Drive

*DriveType	*Error	*ErrorMessage	*ErrorMode

*File	*FileDate	*FileSize	*FileSystemType

*FileTime	*FreeClusters	*FreeDiskSpace	Height

*Hidden	Index	*IsCDROMDrive	*IsNetworkDrive

Left	Name	*ReadOnly	*SerialNumber

*SerialString	*SubDir	*System	Top

*TotalClusters	*TotalDiskSpace	*VolumeLabel	Width


Events

The VBIO VBX has no events.


Methods

The VBIO VBX supports no methods.


Action Property

Description

Determines the action that VBIO performs. Basically allows you to reread drive and file-properties after an error has occurred

Usage

[Form].VBIO1.Action [= setting%]

Remarks

Use this property to select an action for the VBIO control. The following table describes the possible actions.

Setting	Value	Description

REREAD_DRIVE	1	Attempts to reread the properties of the currently selected drive (see the Drive property). This is useful for testing if a drive is still unavailable.

REREAD_FILE	2	Attempts to reread the properties of the currently selected file (see the File property). This is useful for testing if the inserted disk still does not contain the specified file (on a setup-diskette for example).

Data Type

Integer (Enumerated)


Archive, Hidden, ReadOnly, SubDir and System Properties

Description

Sets or retrieves the file-attributes of the file specified in the File property.

Usage

[Form].VBIO1.Archive [= setting%]

[Form].VBIO1.Hidden [= setting%]

[Form].VBIO1.ReadOnly [= setting%]

[Form].VBIO1.SubDir

[Form].VBIO1.System [= setting%]

Remarks

Although you can change the attributes of a directory, it is not possible to set the SubDir property. This property is read-only.

If an error occurs setting the attributes, the Error and ErrorMessage properties will report the error (Error 6 - Error setting file-attributes). If not, the Error property has a value of zero.

Data Type

Integer (Boolean)


BytesPerSector Property

Description

Reports the amount of bytes per sector of the active drive.

Usage

[Form].VBIO1.BytesPerSector

Remarks

This property reports the bytes per sector of the drive, selected with the Drive property. This property is used (together with the FreeClusters, TotalClusters and SectorsPerCluster properties) in calculating the amount of free diskspace, stored in the FreeDiskSpace property and the total amount of diskspace is stored in the TotalDiskSpace property, using the formulas:

FreeDiskSpace = FreeClusters * SectorsPerCluster * BytesPerSector

TotalDiskSpace = TotalClusters * SectorsPerCluster * BytesPerSector

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


Drive Property

Description

Sets or retrieves the active drive.

Usage

[Form].VBIO1.Drive [= setting%]

Remarks

Use this property to select the active drive for the VBIO control. The Drive property is an enumerated property ranging from 0 (drive A:) to 25 (drive Z:). If a drive does not exist or is not ready, the Error property will be set (Error 1 - Drive not ready or Error 2 - Drive does not exist). When you change the drive property to a valid drive, all drive-related properties (like FreeDiskSpace, FileSystemType, VolumeLabel, etc.) are changed to show the selected drive's values.

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Integer (Enumerated)


DriveType Property

Description

Reports the drive type of the current drive.

Usage

[Form].VBIO1.DriveType

Remarks

This property reports the type of the drive, selected with the Drive property. The following table describes the possible drive types.

Setting	Value	Description

Undetermined	0	The drive type could not be determined (drive does not exist).

Removable	1	Floppy disk.

Fixed	2	Fixed disk (harddisk)

Remote	3	Network or CD-ROM drive.

The VBX obtains the value for this property from the GetDriveType windows API-call. Unfortunately, CD-ROM drives and network drives are both reported as type 3 (Remote). To determine if a drive is a CD-ROM drive or a network drive, see the IsCDRomDrive and IsNetworkDrive properties.

Data Type

Integer (Enumerated)


Error, ErrorMessage Properties

Description

Reports the last error that occurred. The Error property reports a number; the ErrorMessage property reports an error-string. If the ErrorMode property is set to 1, errors are also reported as run-time errors.

Usage

[Form].VBIO1.Error

[Form].VBIO1.ErrorMessage

Remarks

Use these properties to determine whether an error has occurred as a result of setting a file's or drive's properties. The following table describes the possible errors and their causes.

ErrorMessage	Error	Description
No errors encountered	0	If no error occurs, the Error property is set to zero.
Drive not ready	32001	Set if you change the Drive property, but there is no disk in the specified drive.
Drive does not exist	32002	Set if you change the Drive property, but the specified drive does not exist.
File does not exist	32003	Set if you change the File property, but the specified file could not be found.
Cannot set volume label of network or CD-ROM drive	32004	Set if you try to set the volume-label of a network or CD-ROM drive.
Error setting volume label	32005	Set if the volume-label could not be changed (disk full, no access rights).
Error setting file-attributes	32006	Set if the file-attributes could not be set (File property not specified or no access rights to the specified file).
Unable to open file	32007	Set if the file date or time could not be changed (no access rights or file corrupted)
Error setting file date or time	32008	Set if the file date or time could not be changed (File property not specified)
Invalid date format (must be mm/dd/yy)	32009	The date format for a file must be in the order mm/dd/yy. If not, this error is set.
Invalid time format (must be hh:mm:ss)	32010	The time format for a file must be in the order hh:mm:ss. If not, this error is set.
Cannot set serial-number of network or CD-ROM drive	32011	Set if you try to set the serial-number of a CD-ROM or network drive.
Invalid serial-number string format	32012	The serial-number format you have specified is not correct. The control expects a string formatted as XXXX:XXXX, where X represents a single digit hexadecimal value.
Error setting serial-number	32013	Set if changing the serial-number was unsuccessful (no access rights or running in Windows with 32-bit disk-access).

Data Type

Integer (Enumerated), String


ErrorMode Property

Description

Sets or retrieves the way in which the VBIO VBX reports errors.

Usage

[Form].VBIO1.ErrorMode = [setting%]

Remarks

Use this property to determine how errors are reported. The default behavior is that all errors are reported in the Error and ErrorMessage properties. It may be possible however that you prefer to get a trappable run-time error as well.

The following table describes the possible settings for the ErrorMode property.

Setting	Value	Description

Property-only	0	Reports all errors in the Error and ErrorMessage properties. Only generates a trappable error when you try to set a read-only property.

Runtime error	1	Reports all errors in the Error and ErrorMessage properties AND generates a trappable run-time error. The error-number and error-text of the trappable error are the values from the Error and ErrorMessage properties.

Data Type

Integer (Enumerated)


File Property

Description

Sets or retrieves the active file.

Usage

[Form].VBIO1.File [= setting$]

Remarks

Use this property to select the active file for the VBIO control. The File property is a string. You can set the File property to any valid file- or directoryname. If a file does not exist, the Error property will be set (Error 3 - File does not exist). When you change the File property to a valid file, all file-related properties (like FileSize, FileDate, FileTime, etc.) are changed to show the selected file's values.

Data Type

String


FileDate Property

Description

Sets or retrieves the date the active file was last modified.

Usage

[Form].VBIO1.FileDate [= setting$]

Remarks

Use this property to change the date of  the file, selected with the File property.

To change a file's date, set FileDate to another date using the format mm/dd/yy. If the dateformat is not correct the Error property will be set (Error 9 - Invalid date format). If you do not have access rights to the current file or if you have not specified a file yet, the Error property will be set to 7 or 8.

Note	It is not possible to change the date and time of a directory. If you try to change a directory's date or time, the Error property will be set to 7 (Unable to open file).

Data Type

String


FileSize Property

Description

Reports the size in bytes of the active file.

Usage

[Form].VBIO1.FileSize

Remarks

This property reports the size of the file, selected with the File property.

This property is read-only; that means that you cannot change the size of a file. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


FileSystemType Property

Description

Reports the type of filesystem for the active drive.

Usage

[Form].VBIO1.FileSystemType

Remarks

This property reports the filesystem that is supported by the active drive, selected with the Drive property. Usually this property reads FAT16.

This property is read-only, that means that you cannot change the filesystemtype. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

String


FileTime Property

Description

Sets or retrieves the time the active file was last modified.

Usage

[Form].VBIO1.FileTime [= setting$]

Remarks

Use this property to change the time of  the file, selected with the File property.

To change a file's time, set FileTime to another time using the format hh:mm:ss. If the timeformat is not correct the Error property will be set (Error 10 - Invalid time format). If you do not have access rights to the current file or if you have not specified a file yet, the Error property will be set to 7 or 8.

Note	It is not possible to change the date and time of a directory. If you try to change a directory's date or time, the Error property will be set to 7 (Unable to open file).

Data Type

String


FreeClusters Property

Description

Reports the amount of free clusters of the active drive.

Usage

[Form].VBIO1.FreeClusters

Remarks

This property reports the amount of free clusters of the drive, selected with the Drive property. This property is used (together with the BytesPerSector and SectorsPerCluster properties) in calculating the amount of free diskspace, stored in the FreeDiskSpace property, using the formula:

FreeDiskSpace = FreeClusters * SectorsPerCluster * BytesPerSector

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


FreeDiskSpace Property

Description

Reports the amount of free space in bytes of the active drive.

Usage

[Form].VBIO1.FreeDiskSpace

Remarks

This property reports the amount of free diskspace of the drive, selected with the Drive property. The total amount of diskspace is stored in the TotalDiskSpace property.

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


IsCDROMDrive Property

Description

Reports whether or not the active drive is a CD-ROM drive.

Usage

[Form].VBIO1.IsCDROMDrive

Remarks

This property is True when the active drive, selected with the Drive property, is a CD-ROM Drive; it is False otherwise.

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Integer (Boolean)


IsNetworkDrive Property

Description

Reports whether or not the active drive is a network drive.

Usage

[Form].VBIO1.IsNetworkDrive

Remarks

This property is True when the active drive, selected with the Drive property, is a network drive; it is False otherwise.

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Integer (Boolean)


SectorsPerCluster Property

Description

Reports the amount of sectors per cluster of the active drive.

Usage

[Form].VBIO1.SectorsPerCluster

Remarks

This property reports the sectors per cluster of the drive, selected with the Drive property. This property is used (together with the FreeClusters, TotalClusters and BytesPerSector properties) in calculating the amount of free diskspace, stored in the FreeDiskSpace property and the total amount of diskspace is stored in the TotalDiskSpace property, using the formulas:

FreeDiskSpace = FreeClusters * SectorsPerCluster * BytesPerSector

TotalDiskSpace = TotalClusters * SectorsPerCluster * BytesPerSector

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


SerialNumber Property

Description

Sets or retrieves the disk serialnumber of the active drive.

Usage

[Form].VBIO1.SerialNumber [= setting&]

Remarks

Use this property to get or set the disk serial number of the drive, selected with the Drive property. Since the serialnumber can only be set using an interrupt that is not directly callable from within Windows, it is set using DPMI. A drawback to this is that it is not possible to set the serialnumber in Windows Standard mode.

If you try to set the serialnumber of a CD-ROM or network drive, the Error property is set to 11 (Cannot set serialnumber of CD-ROM or network drive). If an error occurs trying to set the serialnumber (you cannot set the serialnumber if 32-bits disk-access is turned on, or you may not have the right to change the disk's boot sector), the Error property is set to 13 (Error setting serialnumber).

Warning

The SerialNumber property is represented as a Long, that means a 32-bit signed integer. This is the biggest non-fractional datatype VB offers. However, a serial number for a disk is a DWORD (double word), that is a 32-bit unsigned integer. So, if your serial-number becomes bigger than 2,147,483,647 (7FFF:FFFF), you'll notice that the reported serial-number will wrap and be negative. To obtain the real-serial number, you'll have to convert the negative long-integer to a double using the following formula:

If VBIO1.SerialNumber<0 Then

    	RealSerial = 2# * 2147483648# + CDbl(VBIO1.SerialNumber)

Else

RealSerial# = CDbl(VBIO1.SerialNumber)

End If

Likewise, if you want to set a serialnumber bigger than 7FFF:FFFF, convert the double into a serial-number using the following formula:

If RealSerial#>2147483647 Then

VBIO1.SerialNumber = CLng(RealSerial# - 2# * 2147483648#)

Else

VBIO1.SerialNumber = CLng(RealSerial#)

Endif

Data Type

Long


SerialString Property

Description

Sets or retrieves the disk serialnumber, formatted as a string, of the active drive.

Usage

[Form].VBIO1.SerialString [= setting$]

Remarks

Use this property to get or set the disk serial number of the drive, selected with the Drive property. Since the serialnumber can only be set using an interrupt that is not directly callable from within Windows, it is set using DPMI. A drawback to this is that it is not possible to set the serialnumber in Windows Standard mode.

The SerialString is formatted as a string containing 8 hexadecimal digits. The first four digits specify the high-order word of the serialnumber; the last four digits specify the low order word. The two groups are separated by a colon. If you use another format changing the SerialString property, the Error property is set to 12 (Invalid serial-number string format).

If you try to set the serialnumber of a CD-ROM or network drive, the Error property is set to 11 (Cannot set serialnumber of CD-ROM or network drive). If an error occurs trying to set the serialnumber (you cannot set the serialnumber if 32-bits disk-access is turned on, or you may not have the right to change the disk's boot sector), the Error property is set to 13 (Error setting serialnumber).

Data Type

String


TotalClusters Property

Description

Reports the total amount of clusters of the active drive.

Usage

[Form].VBIO1.TotalClusters

Remarks

This property reports the total amount of clusters of the drive, selected with the Drive property. This property is used (together with the BytesPerSector and SectorsPerCluster properties) in calculating the total amount of diskspace, stored in the TotalDiskSpace property, using the formula:

TotalDiskSpace	= TotalClusters * SectorsPerCluster * BytesPerSector

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


TotalDiskSpace Property

Description

Reports the total space in bytes of the active drive.

Usage

[Form].VBIO1.TotalDiskSpace

Remarks

This property reports the amount of total diskspace of the drive, selected with the Drive property. The total amount of free diskspace is stored in the FreeDiskSpace property.

This property is read-only. If you try to change the value of this property, a runtime error will occur (32000 - Property is read-only, changes are ignored).

Data Type

Long


VolumeLabel Property

Description

Sets or retrieves the volume-label of the active drive.

Usage

[Form].VBIO1.VolumeLabel [= setting$]

Remarks

You can use this property to get or set the volume-label of the drive, selected with the Drive property.

If you try to set the volume-label of a CD-ROM or network drive, the Error property is set to 4 (Cannot set volume label of CD-ROM or network drive). If an error occurs trying to set the volume-label (you may not have the right to change the disk's boot sector or the disk is full), the Error property is set to 5 (Error setting volume label).

Data Type

String